﻿namespace UsingClassesAndObjects
{
    using System;
    using System.Collections.Generic;

    class SplittingString
    {
        // 1.2.10.06 You are given a sequence of positive integer values written into a string, separated by spaces.
        // Write a function that reads these values from given string and calculates their sum.
        // Example: string = "43 68 9 23 318" -> result = 461

        static void Main()
        {
            string asdf = "43 68 9 23 318";
            string[] fdsa = asdf.Split(' ');

            int sum = 0;
            for (int i = 0; i < fdsa.Length; i++)
            {
                sum += int.Parse(fdsa[i]);
            }

            Console.WriteLine(sum);
            Console.WriteLine(43 + 68 + 9 + 23 + 318);
        }
    }
}